#include "Call.h"



Call::Call()
{
}

Call::Call(Id * id, vector<Expr*>* varlist)
{
	this->id = id;
	this->varlist = varlist;
}


Call::~Call()
{
}

Expr * Call::reduce()
{
	if(this->varlist!=NULL)
		for (size_t i = 0; i < this->varlist->size(); i++)
		{
			Expr* x = varlist->at(i)->reduce();
			RTL::putData(new Token(tag::PARAM, "push"), NULL, NULL, x);
		}
	Temp* t = new Temp();
	RTL::putData(new Token(tag::CALL,"()"), this, NULL, t);
	return t;
}

string Call::ToRTL()
{
	return this->id->ToRTL() + "()";
}
